// Variables
$o-cw-color-today-accent: #fc3d39;
$o-cw-filter-avatar-size: 20px;

// Animations
@keyframes backgroundfade {
    from {
        background-color: rgba($info, 0.5);
    }
    to {
        background-color: rgba($info, 0.1);
    }
}

.o_calendar_container {
    height: 100%;
    display: flex;
}

.o_calendar_sidebar_container {
    flex: 0 0 auto;
    position: relative;
    @include o-webclient-padding($top: $o-horizontal-padding/2);
    background-color: $o-view-background-color;
    border-left: 1px solid $border-color;
    overflow-y: auto;

    .o_calendar_sidebar {
        width: 200px;
        font-size: 14px;

        @include media-breakpoint-up("xl") {
            width: 250px;
        }
        // sync buttons are only displayed on calendar.event views
        .o_calendar_sync {
            padding-top: 0.5em;
        }
    }

    .ui-datepicker {
        margin: 0;
        width: 100%;
        padding: 0;
        background-color: $o-view-background-color;

        &,
        td,
        .ui-datepicker-header,
        td a,
        td span {
            border: 0;
        }

        th {
            padding: 0.7em 0.2em;
            width: 14%;

            > span {
                color: #666666;
            }
        }

        td {
            padding: 0;

            a,
            span {
                padding: 5px 0;
                background: none;
                text-align: center;
                vertical-align: middle;
                font-size: 1.2rem;
                color: map-get($grays, "900");
                font-weight: 400;
            }

            &.ui-datepicker-current-day a {
                background: $info;
                color: color-contrast($info);
                font-weight: bold;
            }

            &.ui-datepicker-today a {
                margin: auto;
                border-radius: 100%;
                padding: 0.1em;
                width: 25px;
                background: mix($o-cw-color-today-accent, white, 80%);
                color: white;
            }

            &.ui-datepicker-current-day.ui-datepicker-today a {
                background: $o-cw-color-today-accent;
            }
        }

        .ui-datepicker-header {
            background: none;
        }

        .ui-datepicker-header {
            border-radius: 0;

            .ui-datepicker-title {
                color: map-get($grays, "600");
                font-size: 1.2rem;
                font-weight: normal;
            }

            .ui-icon {
                background-image: none;
                text-indent: 0;
                color: transparent;

                &:before {
                    font: normal normal normal 13px/1 FontAwesome;
                    content: "\f053";
                    color: map-get($grays, "400");
                }
                &.ui-icon-circle-triangle-e:before {
                    content: "\f054";
                }
            }

            .ui-state-hover.ui-datepicker-next-hover,
            .ui-state-hover.ui-datepicker-prev-hover {
                background: none;
                border: none;
                cursor: pointer;

                span:before {
                    color: map-get($grays, "800");
                }
            }
        }

        .o_selected_range.o_color:not(.ui-datepicker-unselectable) {
            background-color: $info;
            animation: backgroundfade 2s forwards;
        }
    }

    .o_calendar_filter {
        font-size: 0.9em;
        padding: 2em 0 1em;

        .o_cw_filter_collapse_icon {
            transition: all 0.3s ease;
            @include o-hover-opacity();
            font-size: 0.7em;
        }

        .collapsed .o_cw_filter_collapse_icon {
            transform: rotate(90deg);
            opacity: 1;
        }

        .o_calendar_filter_items_checkall,
        .o_calendar_filter_item {
            cursor: pointer;
            overflow: hidden;

            input {
                z-index: -1;
                opacity: 0;
            }

            .o_cw_filter_input_bg {
                width: 1.3em;
                height: 1.3em;
                border-width: 2px;
                border-style: solid;
                border-radius: 1px;
                overflow: hidden;
                display: flex;

                &.o_beside_avatar {
                    width: $o-cw-filter-avatar-size;
                    height: $o-cw-filter-avatar-size;
                    border-radius: 2px;
                    object-fit: cover;
                }
            }

            input:not(:checked) + label .o_cw_filter_input_bg {
                background: transparent !important;

                i.fa {
                    visibility: hidden;
                }
            }

            .o_cw_filter_avatar {
                width: $o-cw-filter-avatar-size;
                height: $o-cw-filter-avatar-size;
                border-radius: 2px;

                &.fa {
                    padding: 4px 3px;
                }
            }

            .o_cw_filter_title {
                line-height: $o-line-height-base;
                flex-grow: 1;
            }

            button.o_remove {
                @include o-position-absolute(0, 0, 0);
                transform: translateX(100%);
                transition: transform 0.2s;
            }

            &:hover {
                button.o_remove {
                    transform: translateX(0%);
                }
            }
        }

        .o_field_many2one {
            margin-top: 1rem;
            width: 100%;
        }
    }
}

.modal {
    .o_attendee_head {
        width: 32px;
        margin-right: 5px;
    }
}

.o_dashboard {
    .o_calendar_container .o_calendar_sidebar_container {
        display: none;
    }
}
